package company_tencent.f;

import java.util.Scanner;

public class T2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int q = sc.nextInt();
        for (int i = 0; i < q; i++) {
            int left = sc.nextInt();
            int right = sc.nextInt();
            int res = 0;
            // 奇数开始，奇数结束
            if (left % 2 == 1 && right % 2 == 1) {
                res = (right - left) / 2 - right;
            }
            // 奇数开始，偶数结束
            if (left % 2 == 1 && right % 2 == 0) {
                res = (right - left + 1) / 2;
            }
            // 偶数开始，奇数结束
            if (left % 2 == 0 && right % 2 == 1) {
                res = (right - left + 2) / 2 * -1;
            }
            // 偶数开始，偶数结束
            if (left % 2 == 0 && right % 2 == 0) {
                res = (right - left) / 2 * -1 + right;
            }
            System.out.println(res);
        }
    }
}
